#include <iostream>
#include <vector>

using namespace std;

template <typename T>
void read(vector <T> &data) {
    int length;
    cin >> length;
    if (length == 4)
        throw 1;
    data.resize(length);
    for (int i = 0; i < length; ++i) {
        cin >> data[i];
    }
    return;
}

template <typename iterator, typename T>
iterator partition(iterator begin, iterator end, T value) {
    if (end - begin == 0)
        return begin;
    iterator left = begin, right = end - 1;
    while (left != right) {
        while (left != right && *left < value) {
            ++left;
        }
        while (left != right && *right >= value) {
            --right;
        }
        swap(*left, *right);
        if (left == right || left == right - 1)
            break;
        ++left, --right;
    }
    if (*begin >= value)
        return begin;
    while (*left >= value && left != begin)
        --left;
    while (left != end && *left < value)
        ++left;
    return left;
}

int main() {
    vector <int> data;
    read(data);
    int value;
    cin >> value;
    int less = partition(data.begin(), data.end(), value) - data.begin();
    cout << less << endl << data.size() - less << endl;
}